import {Component, OnDestroy, OnInit} from "@angular/core";
import {CommService} from "../comm-service";
import {MyhttpService} from "../myhttp.service";
import {LocalStorageService} from "../local-storage-service";

declare var $: any;
declare var AMap: any;

@Component({
  template: `
    <div class="Room" [style.height]="RoomHeightstr">
      <sjgzxin-title [o]="titleobj"></sjgzxin-title>
      <div class="ywcl_room">
        <div class="ncdiv">
          <ng-container #ywclRoom>
            <div class="arrow" (click)="togglehfCtr()">
              <i *ngIf="hfctrshow" class="fa fa-chevron-down"></i>
              <i *ngIf="!hfctrshow" class="fa fa-chevron-up"></i>
            </div>
            <div class="mapctr">
              <!--搜索轨迹表单-->
              <form class="form-horizontal" role="form">
                <div class="row">
                  <div class="col-lg-2">
                    <div class="form-group">
                      <div class="col-lg-12">
                        <input type="text" class="form-control" placeholder="设备名称/设备id" name="ssbxx"
                               [(ngModel)]="s_obj.id"/>
                      </div>
                    </div>
                  </div>
                  <div class="col-lg-2">
                    <div class="form-group">
                      <label></label>
                      <div class="col-lg-11">
                        <select id="sblxselect" class="form-control" name="sblx" [(ngModel)]="s_obj.cxlx"></select>
                      </div>
                    </div>
                  </div>
                  <div class="col-lg-4">
                    <div class="form-group">
                      <div class="col-lg-12">
                        <div class="input-group">
                          <span class="input-group-addon"><i class="fa fa-calculator"></i></span>
                          <input type="text" class="form-control datetimepickerB_content" id="s_sbtime"
                                 [value]="s_obj.kssj" readonly>
                          <span class="input-group-addon">至</span>
                          <input type="text" class="form-control datetimepickerE_content" id="s_edtime"
                                 [value]="s_obj.jssj" readonly>
                          <span class="input-group-addon"><i class="fa fa-calculator"></i></span>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="col-lg-3">
                    <div class="form-group">
                      <label class="col-lg-3 control-label">定位类型:</label>
                      <div class="col-lg-8">
                        <select class="form-control" name="dwlx" id="dwlxSelect" multiple></select>
                      </div>
                    </div>
                  </div>
                  <div class="col-lg-1">
                    <div class="form-group">
                      <button type="button" class="btn btn-sm blue" (click)="searchGJ()"><i class="fa fa-search"></i> 确定
                      </button>
                    </div>
                  </div>
                </div>
              </form>
              <!--控制回放，说明-->
              <div class="row">
                <div class="col-lg-3">
                  <div class="col-lg-12">
                    <form class="form-horizontal" role="form">
                      <div class="form-group">
                        <label class="col-lg-4 control-label">停留标记：</label>
                        <div class="col-lg-8">
                          <select class="form-control" name="tlbj" id="tlbjSelect" [(ngModel)]="tlbjv"
                                  (change)="tlbjHand()"></select>
                        </div>
                      </div>
                      <div class="form-group">
                        <label class="col-lg-8 control-label">显示停留标记：</label>
                        <div class="col-lg-3">
                           <span class="icon_on control-label" *ngIf="tlbj_show" (click)="toggleOnOff()">
                          <i class="fa fa-toggle-on"></i>
                        </span>
                          <span class="icon_off control-label" *ngIf="!tlbj_show" (click)="toggleOnOff()">
                            <i class="fa fa-toggle-off"></i>
                          </span>
                        </div>
                      </div>
                    </form>
                  </div>

                </div>
                <div class="col-lg-6">
                  <div class="hfCtroom">
                    <div class="hfmsg">
                      <form class="form-horizontal" role="form">
                        <div class="form-group" style="margin-bottom: 0px">
                          <label class="col-lg-3 control-label">进度：</label>
                          <div class="col-lg-8">
                            <div class="myprogress">
                              <div class="nowgress" [style.width]="nowPointer.jdv"></div>
                            </div>
                          </div>
                        </div>
                        <div class="form-group" style="margin-bottom: 0px">
                          <label class="col-lg-3 control-label">时间：</label>
                          <div class="col-lg-8">
                            <label class="control-label">{{nowPointer.sj}}</label>
                          </div>
                        </div>
                        <div class="form-group" style="margin-bottom: 0px">
                          <label class="col-lg-3 control-label">速度：</label>
                          <div class="col-lg-8">
                            <label class="control-label">{{nowPointer.sd}}km/h</label>
                          </div>
                        </div>
                      </form>
                    </div>
                    <div class="hfCtr">
                      <span title="回放" *ngIf="!ishfing" (click)="hfCtr(1)"><i class="fa fa-play-circle"></i></span>
                      <span title="暂停回放" *ngIf="ishfing" (click)="hfCtr(-1)"><i class="fa fa-pause-circle"></i></span>
                    </div>
                    <div class="hfSpeed">
                      <span>回放速度：</span>
                      <input type="text" id="range_hfctr" value="" name="range"/>
                    </div>
                  </div>
                </div>
                <div class="col-lg-3">
                  <div class="col-lg-12">
                    <div class="form-group">
                      <span style="display: inline-block;padding: 5px 8px;color:#39A1F4"><i class="fa fa-circle"></i> GPS定位</span>
                      <span style="display: inline-block;padding: 5px 8px;color:#23D96E"><i class="fa fa-circle"></i> 基站定位</span>
                      <span style="display: inline-block;padding: 5px 8px;color:#0050C3"><i class="fa fa-circle"></i> 终端定位</span>
                    </div>
                  </div>
                  <div class="col-lg-12">
                    <div class="form-group">
                      <button type="button" class="btn btn-sm blue">
                        <i class="fa fa-play-circle-o"></i> 导入轨迹播放
                      </button>
                      &nbsp;&nbsp;&nbsp;&nbsp;
                      <button type="button" class="btn btn-sm blue">
                        <i class="fa fa-download"></i> 导出轨迹
                      </button>
                    </div>
                  </div>
                </div>
              </div>
            </div>
            <div id="mapdiv"></div>
          </ng-container>
        </div>
      </div>
    </div>
  `,
  styles: [
    ".Room{overflow: auto}",
    ".ywcl_room{width: 1920px;height: 1022px;overflow: hidden;background-color:#d9dcde;padding:5.5px 5px;}",
    ".ncdiv{width:1910px;height:1011px;position: relative;}",
    // 地图，固定部分
    "#mapdiv{border:5px solid #ccc; width: 100%;height:100%; position: absolute;left:0px;top: 0px;}",
    ".mapctr{position: absolute;left:210px;top: 5px; height: 160px;width: 1500px;padding: 10px 5px; background-color: #ffffff;z-index: 100;border-bottom: 3px solid #ccc;border-radius: 0px 0px 150px 150px}",
    ".icon_on{color: blue;border: none;cursor: pointer;font-size: 20px}",
    ".icon_off{color: #000;border: none;cursor: pointer;font-size: 20px}",

    ".hfCtroom{width: auto; height: 95px; background-color: #AFDAF9;border-radius: 30px;padding: 5px 0px;}",
    ".hfmsg{float: left; width: 45%;height: auto}",
    ".hfCtr{float: left; width: 10%;height: 95px;line-height: 95px;text-align: center;font-size: 40px;color: blue; cursor: pointer}",
    ".hfSpeed{float:left;width: 30%;height: auto}",
    ".myprogress{width: 100%;height: 10px;background-color: grey;position: relative;border-radius: 10px;margin-top: 12px;}",
    ".nowgress{position: absolute;top: 0px;left: 0px;background-color:#39A1F4;height: 10px; border-radius: 10px;}",
    ".arrow{position: absolute; width: 60px;height: 15px;line-height: 15px; top: -5.5px;left: 905px;text-align: center; background-color: #39A1F4;color: #ffffff;cursor: pointer;z-index: 1000}"

  ]
})
export class GjhfComponent implements OnInit, OnDestroy {
  RoomHeightstr: string = "0px";
  titleobj: any;
  map: any;
  geocoder: any; // 搜索服务插件
  graspobj: any; // 轨迹纠偏服务插件
  mapwin: any; // 信息窗口对象
  s_obj: any = {
    id: '',
    cxlx: "",
    kssj: "",
    jssj: "",
    dwlxList: []
  };
  tlbjv: number = 10;  // 停留标记时间，10分钟
  tlbj_show: boolean = false; // 是否显示停留标记
  tlbj_marks: any[] = [];


  ishfing: boolean = false; // 当前是否在回放， 控制按钮图标和点击的方法  true【||】 false 【D】
  suspend: boolean = true; //暂停（未播放）
  hf_lock: any;
  intervalnum: number = 1000;
  hfctrshow: boolean = true; //回放面板的显示与否
  hfPointerList: any[] = []; // 当前要回放的轨迹数据
  hfPolyline: any; // 要回放的路径对象

  hashfPointerList: any[] = []; //已经回放的数据
  passedPolyline: any; // 回放过的路径对象

  polylineColor: any = {
    'all': '#F70808',
    "gps": "#39A1F4",
    "jz": "#23D96E",
    "zd": "#0050C3"
  };
  nowPointer: any = {
    jdv: "0%",  // 当前回放点时候，回放的点占整个回放轨迹点的百分比
    sj: "", // 当前回放点的时间
    sd: "", //当前回放点的速度
  }; // 当前回放点的信息
  nowMarker: any; // 当前回放的车marker

  /**
   * 搜索回放数据
   */
  searchGJ(): void {
    this.s_obj.kssj = $('#s_sbtime').val() ? $('#s_sbtime').val() : this.s_obj.kssj;
    this.s_obj.jssj = $('#s_edtime').val() ? $('#s_edtime').val() : this.s_obj.jssj;
    if (this.s_obj.cxlx == "sczdsb") {
      //终端无  定位类型
      this.s_obj.dwlxList = [];
    } else if (this.s_obj.cxlx == "dzbqsb") {
      this.s_obj.dwlxList = $("#dwlxSelect").selectpicker("val");
    }

    this.commService.log("搜索条件", this.s_obj);
    if (!this.s_obj.id) {
      this.commService.myswal("warning", "请输入设备id", "", "ts", null);
      return
    }
    // 搜索出来结果以后,还原为最初的状态
    const url = "sjgz/gjcx/cxlsgj";
    this.itservice.kwPtPost(url, this.s_obj).subscribe(resp => {
      this.commService.handResponse("get", url, resp, (arg1, resp, arg2) => {
        if (arg1) {
          if (arg2) {
            this.resetHform();
            const lsgjListv = resp.lsgjList ? resp.lsgjList : [];
            if (!lsgjListv.length) {
              return
            }
            this.hfPointerList = lsgjListv;
            //路径
            let polylineColorv: string = "";
            if (this.s_obj.dwlxList.length > 1 || this.s_obj.dwlxList.length == 0) {
              polylineColorv = this.polylineColor['all'];
            } else {
              polylineColorv = this.polylineColor[this.s_obj.dwlxList[0]];
            }
            this.hfPolyline.setOptions({
              strokeColor: polylineColorv,
              //zIndex: 50
            });
            const hfLinedata = lsgjListv.map((item) => {
              return [item.jd, item.wd];
            });
            this.hfPolyline.setPath(hfLinedata);
            //车
            this.nowMarker.show();
            this.nowMarker.setPosition(hfLinedata[0]);
            this.nowMarker.setAngle(Number(lsgjListv[0].fxj) + 90 + 180);
          }
        }
      });
    });
    // 处理停留标识
    this.tlbjHand();
  }

  /***
   * 回放状态还原
   */
  resetHform(): void {
    if (this.hf_lock) {
      clearInterval(this.hf_lock);
    }
    this.hfPointerList.length = 0;
    this.hashfPointerList.length = 0;
    this.hfPolyline.setPath([]);
    this.passedPolyline.setPath([]);
    this.nowMarker.hide();
    this.nowPointer.jdv = "0%";
    this.nowPointer.sj = "";
    this.nowPointer.sd = "";
    this.ishfing = false;
    this.suspend = false;
  }

  /**
   * 把sliderv 的值转化为 播放速度（定时器的值）
   * @param {number} sliderv
   */
  handSeepd(sliderv: number): void {
    const convertv: number = sliderv - 101;
    const speedv = Math.abs(convertv); // 100-----1
    // 转化规则依据， sliderv =50,处于正中间是，默认速度。 1秒（1000ms）/个坐标点
    this.intervalnum = speedv * 20;  //N ms/个
    this.commService.log("回放速度", this.intervalnum);
    if (this.ishfing) {
      if (this.hf_lock) {
        clearInterval(this.hf_lock);
      }
      this.hfDone();
      this.hf_lock = setInterval(() => {
        this.hfDone();
      }, this.intervalnum);
    }
  }


  /**
   * 回放控制
   * 1--回放
   * -1 --暂停回放
   * @param {number} num
   */
  hfCtr(num: number): void {
    switch (num) {
      case 1:
        if (!this.hfPointerList.length) {
          this.commService.myswal("warning", "未搜索到回放数据", "", "ts", null);
          return
        }
        this.ishfing = true;
        if (this.suspend) {
          // 继续回放直至结束
          this.suspend = false;
        } else {
          // 从头开始的播放
          if (this.hf_lock) {
            clearInterval(this.hf_lock);
          }
          this.hfDone();
          this.hf_lock = setInterval(() => {
            this.hfDone();
          }, this.intervalnum);
        }

        break;
      case -1:
        this.ishfing = false;
        this.suspend = true; // 暂停了
        break;
    }
  }


  /**
   * 回放处理，按点回放
   */
  hfDone(): void {
    if (this.suspend) {
      return
    }
    const hashfLenth = this.hashfPointerList.length;
    const hfpointerLength = this.hfPointerList.length;
    if (hashfLenth < hfpointerLength) {
      const nowpointer = this.hfPointerList[hashfLenth];
      const sjv = nowpointer.sj;
      const sdv = nowpointer.sd;
      this.nowPointer.sj = sjv;
      this.nowPointer.sd = sdv;
      this.nowMarker.setPosition([nowpointer.jd, nowpointer.wd]);
      this.nowMarker.setAngle(Number(nowpointer.fxj) + 90 + 180);
      this.hashfPointerList.push(nowpointer);
      const jdv = (this.hashfPointerList.length / hfpointerLength * 100).toFixed(1);
      this.nowPointer.jdv = `${jdv}%`;
      this.commService.log("this.hashfPointerList", this.hashfPointerList);
      const passendLine = this.hashfPointerList.map((item) => {
        return [item.jd, item.wd];
      });
      this.passedPolyline.setPath(passendLine);
      const zoomv = this.map.getZoom();//缩放级别
      this.map.setZoomAndCenter(zoomv, this.nowMarker.getPosition());
    } else {
      this.commService.myswal("success", "回放结束", "", "ts", null);
      this.hashfPointerList.length = 0;
      this.nowPointer.jdv = "0%";
      this.nowPointer.sj = "";
      this.nowPointer.sd = "";
      this.ishfing = false;
      this.suspend = false;
      if (this.hf_lock) {
        clearInterval(this.hf_lock);
      }
    }
  }


  /**
   * 处理停留标记
   */
  tlbjHand(): void {
    // 停留标记
    if (!this.tlbj_show) {
      // 是否显示  开关关，不请求数据，不绘制停留marker, 并清空原来的
      if (this.tlbj_marks.length) {
        this.map.remove(this.tlbj_marks);
        this.tlbj_marks.length = 0;
      }
      return
    }
    // 请求数据，且绘制停留marker
    const kssj = $('#s_sbtime').val() ? $('#s_sbtime').val() : this.s_obj.kssj;
    const jssj = $('#s_edtime').val() ? $('#s_edtime').val() : this.s_obj.jssj;
    const id = this.s_obj.id;
    const tlcssj = this.tlbjv;   //单位  分钟
    if (!id) {
      this.commService.myswal("warning", "请输入设备id", "", "ts", null);
      return
    }
    const url = "sjgz/gjcx/cxcstlwz";
    this.itservice.kwPtPost(url, {
      kssj: kssj,
      jssj: jssj,
      id: id,
      tlcssj: tlcssj
    }).subscribe(resp => {
      this.commService.handResponse("get", url, resp, (arg1, resp, arg2) => {
        if (arg1) {
          if (arg2) {
            const tlcswzListv = resp.tlcswzList ? resp.tlcswzList : [];
            // tlcswzListv = [{
            //   tlsj: "20",
            //   jd: 113.7559962188,
            //   wd: 34.8805456356,
            //   cstlkssj: ""
            // }]

            if (!tlcswzListv.length) {
              //清空原来的
              this.map.remove(this.tlbj_marks);
              this.tlbj_marks.length = 0;
              return
            }
            //清空原来的
            this.map.remove(this.tlbj_marks);
            this.tlbj_marks.length = 0;
            tlcswzListv.forEach((obj) => {
              if (obj.jd && obj.wd) {
                const marker = new AMap.Marker({
                  map: this.map,
                  position: [obj.jd, obj.wd],
                  visible: true,
                  offset: new AMap.Pixel(-27, -30),
                  //angle: Number(markobj.fxj) + 90 + 180,
                  icon: new AMap.Icon({
                    //34x18px
                    image: "assets/img/sjgz/tlbj.jpg",
                    imageOffset: new AMap.Pixel(0, 0),
                    imageSize: new AMap.Size(54, 60)
                  }),
                  label: {
                    offset: new AMap.Pixel(10, 0),  //设置文本标注偏移量
                    content: `停留${obj.tlsj}分钟`,
                    direction: 'bottom' //设置文本标注方位
                  },
                  zIndex: 100,  //默认值是100
                  extData: {}
                });
                this.tlbj_marks.push(marker);
              }
            });
          } else {
            this.commService.myswal("warning", resp, "", "ts", null);
          }
        }
      });
    });
  }


  /**
   * 头部面板的显示/隐藏控制
   */
  togglehfCtr(): void {
    this.hfctrshow = !this.hfctrshow;
    if (this.hfctrshow) {
      $(".mapctr").slideDown()
    } else {
      $(".mapctr").slideUp()
    }
  }

  /**
   * 停留标记的显示控制
   */
  toggleOnOff(): void {
    this.tlbj_show = !this.tlbj_show;
    this.tlbjHand();
  }


  initsearchForm(): void {
    //设备类型
    const sblxList: any = [{
      lx: "sczdsb",
      name: "手持终端"
    }, {
      lx: "dzbqsb",
      name: "电子标签"
    }];
    $("#sblxselect").empty();
    let str_sblx: string = "";
    sblxList.forEach((item) => {
      str_sblx += "<option value='" + item.lx + "'>" + item.name + "</option>";
    });
    $("#sblxselect").append(str_sblx);
    $("#sblxselect").selectpicker({
      size: 5,
    });

    $('.datetimepickerB_content').datetimepicker({
      autoclose: true,
      language: 'zh-CN',
      format: 'yyyy-mm-dd hh:ii:ss',
      pickerPosition: "bottom-left",
      minView: 0
    }).on("changeDate", function (ev) {
      const selectdate = ev.date.valueOf(); // 实际时间+ 8h
      // 结束时间不能小于开始时间,
      $(".datetimepickerE_content").datetimepicker("setStartDate", new Date(selectdate - 8 * 60 * 60 * 1000));
    });
    $('.datetimepickerE_content').datetimepicker({
      autoclose: true,
      language: 'zh-CN',
      format: 'yyyy-mm-dd hh:ii:ss',
      pickerPosition: "bottom-left",
      minView: 0
    }).on("changeDate", function (ev) {
      const selectdate = ev.date.valueOf(); // 实际时间+ 8h
      // 开始时间不能大于结束时间
      $(".datetimepickerB_content").datetimepicker("setEndDate", new Date(selectdate - 8 * 60 * 60 * 1000));
    });
    //定位类型
    const dwlx = [{
      lx: "gps",
      name: "GPS定位"
    }, {
      lx: "lac",
      name: "基站定位"
    }, {
      lx: "phone",
      name: "终端定位"
    }];
    $("#dwlxSelect").empty();
    let str_dwlx: string = "";
    dwlx.forEach((item) => {
      str_dwlx += "<option value='" + item.lx + "'>" + item.name + "</option>";
    });
    $("#dwlxSelect").append(str_dwlx);
    $("#dwlxSelect").selectpicker({
      size: 5,
      selectAllText: "全部"
    });
    $("#dwlxSelect").selectpicker("selectAll");

    //停留标记时间
    const tlbjssList: any = [] = [{
      sj: "10",
      name: "10分钟"
    }, {
      sj: "20",
      name: "20分钟"
    }, {
      sj: "30",
      name: "30分钟"
    }];

    $("#tlbjSelect").empty();
    let str_tlsj: string = "";
    tlbjssList.forEach((item) => {
      str_tlsj += "<option value='" + item.sj + "'>" + item.name + "</option>";
    });
    $("#tlbjSelect").append(str_tlsj);
    $("#tlbjSelect").selectpicker({
      size: 5,
    });


    //#######初始化 搜索表单
    const hfsbxxstr = this.localStorageService.get("hfsbxx");
    const hfsbxxobj = hfsbxxstr ? JSON.parse(hfsbxxstr) : {};
    this.s_obj.id = hfsbxxobj.id;
    this.s_obj.cxlx = hfsbxxobj.sblx;
    $("#sblxselect").selectpicker("val", hfsbxxobj.sblx);
    const initBdate = this.commService.YMDHMS_get(Date.now() - 24 * 60 * 60 * 1000);
    const initEdate = this.commService.YMDHMS_get(false);
    this.s_obj.kssj = initBdate;
    this.s_obj.jssj = initEdate;
    this.s_obj.dwlxList = $("#dwlxSelect").selectpicker("val");
    this.searchGJ();

    this.initplugins();
  }

  initplugins(): void {
    const that = this;
    $("#range_hfctr").ionRangeSlider({
      type: 'single',
      skin: "round",   // square  round sharp  modern   big
      hide_min_max: true,
      hide_from_to: true,
      force_edges: true,
      keyboard: true,
      min: 1,
      max: 100,
      from: 50,
      step: 1,
      prefix: "",
      grid: false,
      onChange: function (obj) {
        console.log('onChange', obj);
      },
      onFinish: function (obj) {
        console.log('onFinish', obj);
        that.handSeepd(obj.from);
      }
    });
  }

  initMap(): void {
    const that = this;
    this.map = new AMap.Map("mapdiv", {
      resizeEnable: true, //是否监控地图容器尺寸变化，默认值为false
      zoom: 11, //地图显示的缩放级别，若center与level未赋值，地图初始化默认显示用户所在城市范围，没有center（中心点）和level ，所以这个暂时无效
    }).on("click", (e) => {
      console.log(e);
    });
    AMap.plugin(['AMap.ToolBar', 'AMap.Scale', 'AMap.OverView', 'AMap.Geocoder', "AMap.GraspRoad"],
      function () {
        //缩放，平易等工具条
        //that.map.addControl(new AMap.ToolBar());
        //比例尺
        //that.map.addControl(new AMap.Scale());
        //鹰眼
        that.map.addControl(new AMap.OverView({
          isOpen: false
        }));
        that.geocoder = new AMap.Geocoder({
          radius: 1000,
          extensions: "all"
        });
        that.map.addControl(that.geocoder);
        // 轨迹纠偏
        that.graspobj = new AMap.GraspRoad();
      });
    //信息窗口
    const info = [];
    //info.push("<div><div><img style=\"float:left;\" src=\" http://webapi.amap.com/images/autonavi.png \"/></div> ");
    info.push("<div style='padding:0px 0px 0px 4px'><b>" + "--" + "</b>");
    info.push("</div>");
    this.mapwin = new AMap.InfoWindow({
      content: info.join("<br/>") //使用默认信息窗体框样式，显示信息内容
    });
    that.mapwin.on('close', function () {

    });
    this.hfPolyline = new AMap.Polyline({
      map: this.map,
      zIndex: 60, //  折线覆盖物的叠加顺序。默认叠加顺序，先添加的线在底层，后添加的线在上层  ,默认50
      strokeStyle: "solid",    // 线条样式，
      strokeColor: "blue",  // 线条颜色
      strokeOpacity: 0.8,
      strokeWeight: 7,  // 线条宽度，单位：像素
      showDir: true, // 是否延路径显示白色方向箭头,默认false。Canvas绘制时有效，建议折线宽度大于6时使用；
    });
    this.passedPolyline = new AMap.Polyline({
      map: this.map,
      zIndex: 60, //  折线覆盖物的叠加顺序。默认叠加顺序，先添加的线在底层，后添加的线在上层  ,默认50
      strokeStyle: "solid",    // 线条样式，
      strokeColor: "blue",  // 线条颜色
      strokeOpacity: 0.8,
      strokeWeight: 7,  // 线条宽度，单位：像素
      showDir: true, // 是否延路径显示白色方向箭头,默认false。Canvas绘制时有效，建议折线宽度大于6时使用；
    });
    this.nowMarker = new AMap.Marker({
      map: this.map,
      visible: false,
      offset: new AMap.Pixel(-17, -9),
      //angle: Number(markobj.fxj) + 90 + 180,
      icon: new AMap.Icon({
        //34x18px
        image: "assets/img/sjgz/car_blue.png",
        imageOffset: new AMap.Pixel(0, 0),
        imageSize: new AMap.Size(34, 18)
      }),
      zIndex: 100,  //默认值是100
      extData: {}
    });
  }

  constructor(private commService: CommService,
              private localStorageService: LocalStorageService,
              private itservice: MyhttpService) {

  }

  ngOnInit() {
    this.titleobj = {
      frompage: "zsywcl"
    };
    this.initMap();
    this.RoomHeightstr = `${this.commService.getViewPort().height}px`;
    this.initsearchForm();
  }

  ngOnDestroy() {
    if (this.hf_lock) {
      clearInterval(this.hf_lock);
    }
  }
}
